package com.yzd.learnjava.annotaions;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import com.yzd.learnjava.util.OSExecute;
import com.yzd.learnjava.util.Print;

public class AtUnitExample2 {
	
	public String methodOne() {
		return "This is methodOne";
	}
	
	public int methodTwo() {
		Print.print("This is methodTwo");
		return 2;
	}
	
	@Test
	void assertExample() {
		assert methodOne().equals("This is methodOne");
	}
	
	@Test
	void assertFailureExample() {
		assert 1==2 : "What a surprise!";
	}
	
	@Test
	void exceptionExample() throws IOException {
		new FileInputStream("nofile.txt");
	}
	
	@Test
	boolean assertAndReturn() {
		assert methodTwo() == 2 : "MethodTwo must equals 2";
		return methodOne().equals("This is methodOne");
	}
	
	public static void main(String[] args) {
		OSExecute.command("java com.yzd.learnjava.atunit.AtUnit AtUnitExample2");
	}
}
